package com.zd.core.dao.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class DbUtil {
	/**
	 * 骆驼明明发
	 * @param propertyName
	 * @return
	 */
	public static String upperCaseToUnderline(String propertyName) {
		Pattern pattern = Pattern.compile("([A-Z])");
		Matcher matcher = pattern.matcher(propertyName);
		
		while (matcher.find()) {
			propertyName = propertyName.replace(matcher.group(1), "_" + matcher.group(1).toLowerCase());
		}
		
		if(propertyName.substring(0, 1).equals("_"))
			propertyName = propertyName.substring(1);
		return propertyName;
	}
}
